var express = require('express');
var router = express.Router();
const db = require('../public/javascripts/db');

/* GET users listing. */
router.put('/', function(req, res, next) {
    let info = req.body;
    let sql = "update owner set owner_name=?, owner_tel=?, owner_peoplenum=?, owner_buildingnumber=?, owner_unit=?, owner_floor=?, owner_tablet=? where owner_id=?";
    let data = [info.owner_name,info.owner_tel,info.owner_peoplenum,info.owner_buildingnumber,info.owner_unit,info.owner_floor,info.owner_tablet,info.owner_id];
    db(sql,data,(result)=>{
        if(result.affectedRows ==1){
            res.json({
                code:200,
                message:"修改用户信息成功"
            })
        }
        else{
            res.json({
                code:500,
                message:"服务器错误"
            })
        }
    })
});

module.exports = router;
